package com.zhouyer.study.demo.controller;

import com.zhouyer.study.demo.service.IDemoService;
import com.zhouyer.study.mvcframework.annotations.Security;
import com.zhouyer.study.mvcframework.annotations.ZyAutoWired;
import com.zhouyer.study.mvcframework.annotations.ZyController;
import com.zhouyer.study.mvcframework.annotations.ZyRequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@ZyController
@ZyRequestMapping("/demo")
public class DemoController {

    @ZyAutoWired
    public IDemoService demoService;

    @ZyRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response, String name) {
        demoService.query(name);
    }

    @ZyRequestMapping("/handle01")
    @Security(value = {"wangwu", "zhangsan"})
    public String handle01(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("访问DemoController控制器中的handle01成功");
        return "ok";
    }

    @ZyRequestMapping("/handle02")
    @Security({"test"})
    public String handle02(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("访问DemoController控制器中的handle02成功");
        return "ok";
    }
}
